package com.pipi.biyesheji.dao.manager.impl;

import com.pipi.biyesheji.dao.support.PageResult;
import com.pipi.biyesheji.dao.model.ReviewDO;
import com.pipi.biyesheji.dao.query.ReviewQuery;
import com.pipi.biyesheji.dao.mapper.ext.ReviewExtMapper;
import com.pipi.biyesheji.dao.manager.ReviewManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for Review.
 */

@Component
public class ReviewManagerImpl implements ReviewManager{

    
    @Autowired
    protected ReviewExtMapper reviewExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(ReviewQuery query){
        return reviewExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(ReviewQuery query){
        return reviewExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(Long id){
        return reviewExtMapper.deleteByPrimaryKey(id);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(ReviewDO record){
        return reviewExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<ReviewDO> selectByQuery(ReviewQuery query){
        return reviewExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<ReviewDO> selectByQueryWithPage(ReviewQuery query) {
        PageResult<ReviewDO> result = new PageResult<ReviewDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public ReviewDO selectByPrimaryKey(Long id){
        return reviewExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( ReviewDO record,  ReviewQuery query){
        return reviewExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( ReviewDO record,  ReviewQuery query){

        return reviewExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(ReviewDO record){
        return reviewExtMapper.updateByPrimaryKeySelective(record);
    }
}